package research.ui.views.comparators;

import org.eclipse.jface.viewers.Viewer;

import research.domain.Research;

public class ResearchDateComparator extends EntityComparator {

	@Override
	public int compare(Viewer viewer, Object e1, Object e2) {
		if (e1 instanceof Research && e2 instanceof Research) {
			if (isDesc()) {
				Object e = e1;
				e1 = e2;
				e2 = e;
			}
			Research res1 = (Research) e1;
			Research res2 = (Research) e2;
			return res1.getDate().compareTo(res2.getDate());
		}
		return super.compare(viewer, e1, e2);
	}


	
}
